package one.stand.feign;

import one.stand.fallback.WechatFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author Administrator
 */
@Component
@FeignClient(value = "wechat-service", fallback = WechatFallBack.class, decode404 = true)
public interface WechatFegin {

    /**
     * 获取代码草稿
     *
     * @return
     */
    @PostMapping("code/template/getTemplateDraftList")
    String getTemplateDraftList();

    /**
     * 获取所有模板
     *
     * @return
     */
    @PostMapping("code/template/getTemplateList")
    String getTemplateList();

    /**
     * 把草稿存为模板
     *
     * @param draftId
     * @return
     */
    @PostMapping("code/template/addTotemplate")
    String addTotemplate(@RequestParam(value="draftId") String draftId);

    /**
     * 代码提交到相应小程序
     *
     * @param appId
     * @param versionId
     * @return
     */
    @PostMapping("code/commit")
    String commit(@RequestParam(value="appId") String appId, @RequestParam(value="versionId") Integer versionId,@RequestParam(value="submitAudit") boolean submitAudit);

    /**
     * 发布小程序
     *
     * @return
     */
    @PostMapping("code/release")
    String release(@RequestParam(value="versionId") Integer versionId,@RequestParam(value="appId") String appId);

    /**
     * 获取体验码权限
     * @param appId
     * @return
     */
    @PostMapping("code/getQrCode")
    String getQrCode(@RequestParam(value="appId") String appId);

    /**
     * 获取审核结果
     * @param versionId
     * @param appId
     * @param release
     * @return
     */
    @PostMapping("code/getLatestAuditStatus")
    String getLatestAuditStatus(@RequestParam(value="versionId") Integer versionId, @RequestParam(value="appId") String appId, @RequestParam(value="release") boolean release);

    /**
     * 提交审核
     * @param versionId
     * @param appId
     * @return
     */
    @PostMapping("code/submitAudit")
    String submitAudit(@RequestParam(value="versionId") Integer versionId,@RequestParam(value="appId") String appId);
}
